package cn.iocoder.yudao.module.system.repository.mybatis.dao.tenant;

import cn.iocoder.yudao.common.pojo.PageResult;
import cn.iocoder.yudao.core.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.core.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.repository.mybatis.domain.tenant.TenantPackage;
import cn.iocoder.yudao.module.system.vo.tenant.packages.TenantPackagePageReqVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 租户套餐 Mapper
 */
@Mapper
public interface TenantPackageMapper extends BaseMapperX<TenantPackage> {

    default PageResult<TenantPackage> selectPage(TenantPackagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantPackage>()
                .likeIfPresent(TenantPackage::getName, reqVO.getName())
                .eqIfPresent(TenantPackage::getStatus, reqVO.getStatus())
                .likeIfPresent(TenantPackage::getRemark, reqVO.getRemark())
                .betweenIfPresent(TenantPackage::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantPackage::getId));
    }

    default List<TenantPackage> selectListByStatus(Integer status) {
        return selectList(TenantPackage::getStatus, status);
    }
}
